"""
召唤师信息实体类
"""
from dataclasses import dataclass


"""
dataclasses这个模块提供了一个装饰器和一些函数，用于自动为用户自定义的类添加生成的 特殊方法 例如 __init__() 和 __repr__()。
"""


@dataclass
class Summoner:
    """
    已登录riot客户端的召唤师信息
    """
    # 账户ID
    accountId: str
    # 连接状态
    connected: bool
    # 错误信息，在发生错误时可能包含一些错误信息。如果没有错误，通常为None。
    error: None
    # ID令牌，用于身份验证和授权的令牌。
    idToken: str
    # 是否在登录队列中，表示召唤师是否在登录队列中等待。
    isInLoginQueue: bool
    # 是否新玩家，表示召唤师是否是新玩家。
    isNewPlayer: bool
    # Puuid，召唤师的唯一PUUID（可持久唯一识别码）。
    puuid: str
    # 状态，表示召唤师的当前状态。
    state: str
    # 召唤师ID，召唤师的唯一召唤师ID。
    summonerId: str
    # 用户令牌，用于用户身份验证的令牌。
    userAuthToken: str
    # 用户名，召唤师的用户名。
    username: str

    def __str__(self):
        return (f"已登录riot客户端的Summoner Info:\n"
                f"  Account ID: {self.accountId}\n"
                f"  Connected: {self.connected}\n"
                f"  Error: {self.error}\n"
                f"  ID Token: {self.idToken}\n"
                f"  In Login Queue: {self.isInLoginQueue}\n"
                f"  New Player: {self.isNewPlayer}\n"
                f"  PUUID: {self.puuid}\n"
                f"  State: {self.state}\n"
                f"  Summoner ID: {self.summonerId}\n"
                f"  User Auth Token: {self.userAuthToken}\n"
                f"  Username: {self.username}")


@dataclass
class Player:
    """
    游戏中各个玩家的信息
    """
    # 账户ID
    accountId: str
    # 显示名称
    displayName: str
    # 游戏名称
    gameName: str
    # 内部名称
    internalName: str
    # 是否更改名称的标志
    nameChangeFlag: bool
    # 下一个等级的完成百分比
    percentCompleteForNextLevel: int
    # 隐私设置
    privacy: str
    # 头像ID
    profileIconId: str
    # Puuid
    puuid: str
    # 召唤师ID
    summonerId: str
    # 召唤师等级
    summonerLevel: int
    # 标签行
    tagLine: str
    # 未命名的标志
    unnamed: bool
    # 上次升级以来的经验值
    xpSinceLastLevel: int
    # 距离下一级所需经验值
    xpUntilNextLevel: int

    def __str__(self):
        return (f"Player Info:\n"
                f"  Account ID: {self.accountId}\n"
                f"  Display Name: {self.displayName}\n"
                f"  Game Name: {self.gameName}\n"
                f"  Internal Name: {self.internalName}\n"
                f"  Name Change Flag: {self.nameChangeFlag}\n"
                f"  Percent Complete for Next Level: {self.percentCompleteForNextLevel}\n"
                f"  Privacy: {self.privacy}\n"
                f"  Profile Icon ID: {self.profileIconId}\n"
                f"  PUUID: {self.puuid}\n"
                f"  Summoner ID: {self.summonerId}\n"
                f"  Summoner Level: {self.summonerLevel}\n"
                f"  Tag Line: {self.tagLine}\n"
                f"  Unnamed: {self.unnamed}\n"
                f"  XP Since Last Level: {self.xpSinceLastLevel}\n"
                f"  XP Until Next Level: {self.xpUntilNextLevel}")


    # def __init__(self, account_id: int, display_name: str, game_name: str, internal_name: str, name_change_flag: bool,
    #              percent_complete_for_next_level: int, privacy: str, profile_icon_id: int, puuid: str,
    #              summoner_id: int, summoner_level: int, tag_line: str, unnamed: bool,
    #              xp_since_last_level: int, xp_until_next_level: int) -> None:   # ->None表示该函数或方法不会返回任何值
    #     self.account_id = account_id
    #     self.display_name = display_name
    #     self.game_name = game_name
    #     self.internal_name = internal_name
    #     self.name_change_flag = name_change_flag
    #     self.percent_complete_for_next_level = percent_complete_for_next_level
    #     self.privacy = privacy
    #     self.profile_icon_id = profile_icon_id
    #     self.puuid = puuid
    #     self.summoner_id = summoner_id
    #     self.summoner_level = summoner_level
    #     self.tag_line = tag_line
    #     self.unnamed = unnamed
    #     self.xp_since_last_level = xp_since_last_level
    #     self.xp_until_next_level = xp_until_next_level


